package com.pi.pro.xcmg.am.common;


import com.pi.framework.core.util.StringUtils;
import com.pi.pro.xcmg.am.common.vo.report.*;
import com.pi.wms.common.WmsConstants;
import com.pi.wms.common.WmsReportUtils;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 *  支持类
 */
public class XcmgAmReportWorkSupport {




//------------------------------------------------------------------------------------------------------------------
//  SQL/
//------------------------------------------------------------------------------------------------------------------

    public final static String nativePagination(ReportPageQueryDto pagination){
        StringBuffer buf = new StringBuffer();
        if (pagination==null){
            return "";
        }
        if (pagination.getPagenumber()<0){
            return "";
        }
        if (pagination.getPagesize()<=0){
            return "";
        }
        int startindex=pagination.getPagenumber()*pagination.getPagesize();
        buf.append(" ");
        buf.append("limit ").append(String.valueOf(startindex)).append(", ").append(String.valueOf(pagination.getPagesize())).append(" ");
        return buf.toString();
    }

//-------------------------------------------------
//  入库单
//-------------------------------------------------

    public final static String nativeReceiveTransDailyData(Map<String, Object> query){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeReceiveTransDailySelect(query));
        buf.append(nativeReceiveTransDailyOrderby(query));
        return buf.toString();
    }

    public final static String nativeStoragePutawayHoldSummaryDailyData(Map<String, Object> query){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeStoragePutawayHoldSummaryDailySelect(query));
        buf.append(nativeStoragePutawayHoldSummaryDailyOrderby(query));
        return buf.toString();
    }


//-------------------------------------------------
//  出库单
//-------------------------------------------------

    public final static String nativeSoDocumentDailyData(Map<String, Object> query){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeSoDocumentDailySelect(query));
        buf.append(nativeSoDocumentDailyOrderby(query));
        return buf.toString();
    }


    public final static String nativeSoDocumentLineDailyData(Map<String, Object> query){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeSoDocumentLineDailySelect(query));
        buf.append(nativeSoDocumentLineDailyOrderby(query));
        return buf.toString();
    }


//-------------------------------------------------
//  库存
//-------------------------------------------------
    public final static String nativeStorageLaneSummaryDailyData(Map<String, Object> query){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeStorageLaneSummaryDailySelect(query));
        buf.append(nativeStorageLaneSummaryDailyOrderby(query));
        return buf.toString();
    }

    public final static String nativeStorageAgeSummaryData(Map<String, Object> query){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeStorageAgeSummarySelect(query));
        buf.append(nativeStorageAgeSummaryOrderby(query));
        return buf.toString();
    }

    public final static String nativeStorageAgeContainerSummaryData(Map<String, Object> query){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeStorageAgeContainerSummarySelect(query));
        buf.append(nativeStorageAgeContainerSummaryOrderby(query));
        return buf.toString();
    }

    public final static String nativeStorageWarehouseSummaryData(Map<String, Object> query){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeStorageWarehouseSummarySelect(query));
        buf.append(nativeStorageWarehouseSummaryOrderby(query));
        return buf.toString();
    }

    public final static String nativeStorageAgeListData(Map<String, Object> query){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeStorageAgeListSelect(query));
        buf.append(nativeStorageAgeListOrderby(query));
        return buf.toString();
    }



//-------------------------------------------------
//  历史交易汇总
//-------------------------------------------------
    public final static String nativeTransMonthSummaryData(Map<String, Object> query){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeTransMonthSummarySelect(query));
        buf.append(nativeTransMonthSummaryOrderby(query));
        return buf.toString();
    }

    public final static String nativeTransTaskDialySummaryData(Map<String, Object> query){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeTransTaskDailySummarySelect(query));
        buf.append(nativeTransTaskDailySummaryOrderby(query));
        return buf.toString();
    }

    public final static String nativeTransConsDailySummaryData(Map<String, Object> query){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeTransConsDailySummarySelect(query));
        buf.append(nativeTransConsDailySummaryOrderby(query));
        return buf.toString();
    }


//-------------------------------------------------
//  工作站
//-------------------------------------------------
    public final static String nativeStationWorkSummaryDailyData(Map<String, Object> query){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeStationWorkSummaryDailySelect(query));
        buf.append(nativeStationWorkSummaryDailyOrderby(query));
        return buf.toString();
    }

    public final static String nativeStationHoldPutawaySummaryDailyData(Map<String, Object> query){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeStationHoldPutawaySummaryDailySelect(query));
        buf.append(nativeStationHoldPutawaySummaryDailyOrderby(query));
        return buf.toString();
    }

    public final static String nativeStationHoldPickSummaryDailyData(Map<String, Object> query){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeStationHoldPickSummaryDailySelect(query));
        buf.append(nativeStationHoldPickSummaryDailyOrderby(query));
        return buf.toString();
    }






//-------------------------------------------------
//   列表数据/入库单
//-------------------------------------------------
    public final static String nativeInboundTodayDocumentData(Map<String, Object> query, ReportPageQueryDto pagination){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeInboundTodayDocumentSelect(query));
        buf.append(nativeInboundTodayDocumentOrderby(query));
        buf.append(nativePagination(pagination));
        return buf.toString();
    }

    public final static String nativeInboundTodayReceiveTransSumData(Map<String, Object> query, ReportPageQueryDto pagination){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeInboundTodayReceiveTransSumSelect(query));
        buf.append(nativeInboundTodayReceiveTransSumOrderby(query));
        buf.append(nativePagination(pagination));
        return buf.toString();
    }

    public final static String nativeInboundTodayHoldStorageData(Map<String, Object> query, ReportPageQueryDto pagination){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeInboundTodayHoldStorageSelect(query));
        buf.append(nativeInboundTodayHoldStorageOrderby(query));
        buf.append(nativePagination(pagination));
        return buf.toString();
    }



//-------------------------------------------------
//   列表数据/出库单
//-------------------------------------------------
    public final static String nativeOutboundTodayDocumentData(Map<String, Object> query, ReportPageQueryDto pagination){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeOutboundTodayDocumentSelect(query));
        buf.append(nativeOutboundTodayDocumentOrderby(query));
        buf.append(nativePagination(pagination));
        return buf.toString();
    }

    public final static String nativeOutboundTodayDocumentSumData(Map<String, Object> query, ReportPageQueryDto pagination){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeOutboundTodayDocumentSumSelect(query));
        buf.append(nativeOutboundTodayDocumentSumOrderby(query));
        buf.append(nativePagination(pagination));
        return buf.toString();
    }


    public final static String nativeOutboundDocumentDetailsData(Map<String, Object> query, ReportPageQueryDto pagination){
        StringBuffer buf = new StringBuffer();
        buf.append(nativeOutboundDocumentDetailsSelect(query));
        buf.append(nativeOutboundDocumentDetailsOrderby(query));
        buf.append(nativePagination(pagination));
        return buf.toString();
    }




//------------------------------------------------------------------------------------------------------------------
//  TRANSLATE/
//------------------------------------------------------------------------------------------------------------------

    public final static List<CommonTransLineDto> translateToTranslineData(List<Object[]> records){
        List<CommonTransLineDto> trans = new ArrayList<>();
        int i = 0;
        Object object=null;
        CommonTransLineDto dto=null;
        //vwt_act_recv_trans_daily:
        //trans_id, division_id, trans_type, doc_id, doc_number, material_id, material_code, material_name, from_lotno_id, from_lotattr05, qty_trans, qty_trans_each, from_trace_number, from_contain_number, created_date, created_by
        for (Object[] obj : records) {
            i = 0;
            dto = new CommonTransLineDto();
            //
            object=obj[i++];
            dto.setTransid(0L);
            if (object!=null){
                dto.setTransid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            dto.setDivisionid(0L);
            if (object!=null){
                dto.setDivisionid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            dto.setTranstype("");
            if (object!=null){
                dto.setTranstype((String)object);
            }
            //
            object=obj[i++];
            dto.setDocumentid(0L);
            if (object!=null){
                dto.setDocumentid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            dto.setDocumentnumber("");
            if (object!=null){
                dto.setDocumentnumber((String)object);
            }
            //
            object=obj[i++];
            dto.setMaerialid(0L);
            if (object!=null){
                dto.setMaerialid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            dto.setMaerialcode("");
            if (object!=null){
                dto.setMaerialcode((String)object);
            }
            //
            object=obj[i++];
            dto.setMaerialname("");
            if (object!=null){
                dto.setMaerialname((String)object);
            }
            //
            object=obj[i++];
            dto.setFromlotnoid(0L);
            if (object!=null){
                dto.setFromlotnoid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            dto.setFromlotattr05("");
            if (object!=null){
                dto.setFromlotattr05((String)object);
            }
            //
            object=obj[i++];
            dto.setQtytrans(BigDecimal.ZERO);
            if (object!=null){
                dto.setQtytrans(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            dto.setQtytranseach(BigDecimal.ZERO);
            if (object!=null){
                dto.setQtytranseach(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            dto.setFromtracenumber("");
            if (object!=null){
                dto.setFromtracenumber((String)object);
            }
            //
            object=obj[i++];
            dto.setFromcontainnumber("");
            if (object!=null){
                dto.setFromcontainnumber((String)object);
            }
            //
            object=obj[i++];
            dto.setCreateddate(null);
            if (object!=null){
                dto.setCreateddate(WmsReportUtils.dateValueOf(object));
            }
            //
            object=obj[i++];
            dto.setCreatedby("");
            if (object!=null){
                dto.setCreatedby((String)object);
            }
            //
            trans.add(dto);
        }
        return trans;
    }

    public final static List<Long> translateToDataIdsData(List<Object[]> records){
        List<Long> ids = new ArrayList<>();
        Long id=null;
        for (Object[] obj : records) {
            if (obj==null){
                continue;
            }
            id=WmsReportUtils.longValueOf(obj);
            if (id!=null){
                ids.add(id);
            }
        }
        return ids;
    }

    public final static List<CommonDataIdSummaryDto> translateToIdSummaryData(List<Object[]> records){
        List<CommonDataIdSummaryDto> datas = new ArrayList<>();
        int i = 0;
        Object object=null;
        CommonDataIdSummaryDto data=null;
        for (Object[] obj : records) {
            i = 0;
            data = new CommonDataIdSummaryDto();
            //
            object=obj[i++];
            data.setId(0L);
            if (object!=null){
                data.setId(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            data.setTotal(BigDecimal.ZERO);
            if (object!=null){
                data.setTotal(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            datas.add(data);
        }
        return datas;
    }

    public final static List<CommonDocumentDto> translateToDocumentData(List<Object[]> records){
        List<CommonDocumentDto> docs = new ArrayList<>();
        int i = 0;
        Object object=null;
        CommonDocumentDto doc=null;
        for (Object[] obj : records) {
            i = 0;
            doc = new CommonDocumentDto();
            //
            object=obj[i++];
            doc.setDocumentid(0L);
            if (object!=null){
                doc.setDocumentid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            doc.setDocumentnumber("");
            if (object!=null){
                doc.setDocumentnumber((String)object);
            }
            //
            object=obj[i++];
            doc.setRefnumber("");
            if (object!=null){
                doc.setRefnumber((String)object);
            }
            //
            object=obj[i++];
            doc.setDocumentprior(WmsConstants.TASK_PRIOR_NORMAL);
            if (object!=null){
                doc.setDocumentprior((String)object);
            }
            //
            object=obj[i++];
            doc.setDocumentstatus("");
            if (object!=null){
                doc.setDocumentstatus((String)object);
            }
            //
            object=obj[i++];
            doc.setCreateddate(null);
            if (object!=null){
                doc.setCreateddate(WmsReportUtils.dateValueOf(object));
            }
            //
            docs.add(doc);
        }
        return docs;
    }

    public final static List<CommonSoDocumentLineDto> translateToSoDocumentLineData(List<Object[]> records){
        List<CommonSoDocumentLineDto> lines = new ArrayList<>();
        int i = 0;
        Object object=null;
        CommonSoDocumentLineDto line=null;
        for (Object[] obj : records) {
            i = 0;
            line = new CommonSoDocumentLineDto();
            //
            object=obj[i++];
            line.setDivisionid(0L);
            if (object!=null){
                line.setDivisionid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            line.setDetailsid(0L);
            if (object!=null){
                line.setDetailsid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            line.setDocumentid(0L);
            if (object!=null){
                line.setDocumentid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            line.setDocumentnumber("");
            if (object!=null){
                line.setDocumentnumber((String)object);
            }
            //
            object=obj[i++];
            line.setRefnumber("");
            if (object!=null){
                line.setRefnumber((String)object);
            }
            //
            object=obj[i++];
            line.setDocumentprior("");
            if (object!=null){
                line.setDocumentprior((String)object);
            }
            //
            object=obj[i++];
            line.setDocumentstatus("");
            if (object!=null){
                line.setDocumentstatus((String)object);
            }
            //
            object=obj[i++];
            line.setSortationLocationCode("");
            if (object!=null){
                line.setSortationLocationCode((String)object);
            }
            //
            object=obj[i++];
            line.setWorkHandleCode("");
            if (object!=null){
                line.setWorkHandleCode((String)object);
            }
            //
            object=obj[i++];
            line.setNotes("");
            if (object!=null){
                line.setNotes((String)object);
            }
            //
            object=obj[i++];
            line.setMaerialid(0L);
            if (object!=null){
                line.setMaerialid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            line.setMaerialcode("");
            if (object!=null){
                line.setMaerialcode((String)object);
            }
            //
            object=obj[i++];
            line.setMaerialname("");
            if (object!=null){
                line.setMaerialname((String)object);
            }
            //
            object=obj[i++];
            line.setQtyOrdered(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyOrdered(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyOrderedEach(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyOrderedEach(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyAllocated(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyAllocated(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyAllocatedEach(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyAllocatedEach(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyShipped(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyShipped(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyShippedEach(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyShippedEach(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setLinenumber("");
            if (object!=null){
                line.setLinenumber((String)object);
            }
            //
            object=obj[i++];
            line.setLinestatus("");
            if (object!=null){
                line.setLinestatus((String)object);
            }
            //
            object=obj[i++];
            line.setCreateddate(null);
            if (object!=null){
                line.setCreateddate(WmsReportUtils.dateValueOf(object));
            }
            //
            lines.add(line);
        }
        return lines;
    }

    public final static List<StorageLaneSummaryAmountReportDto> translateToStorageLaneAmountData(List<Object[]> records){
        List<StorageLaneSummaryAmountReportDto> lanes = new ArrayList<>();
        int i = 0;
        Object object=null;
        StorageLaneSummaryAmountReportDto lane=null;
        for (Object[] obj : records) {
            i = 0;
            lane = new StorageLaneSummaryAmountReportDto();
            //
            object=obj[i++];
            lane.setDivisionid(0L);
            if (object!=null){
                lane.setDivisionid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            lane.setLanenumber(0);
            if (object!=null){
                lane.setLanenumber(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            lane.setTotal(0);
            if (object!=null){
                lane.setTotal(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            lane.setWorkcount(0);
            if (object!=null){
                lane.setWorkcount(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            lane.setFullcontainercount(0);
            if (object!=null){
                lane.setFullcontainercount(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            lane.setHalfcontainercount(0);
            if (object!=null){
                lane.setHalfcontainercount(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            lane.setEmptycontainercount(0);
            if (object!=null){
                lane.setEmptycontainercount(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            /**
            object=obj[i++];
            lane.setReservecount(0);
            if (object!=null){
                lane.setReservecount(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
             **/
            lane.setReservecount(lane.getTotal()-lane.getWorkcount());
            //
            lanes.add(lane);
        }
        return lanes;
    }

    public final static List<StorageWarehouseSummaryReportDto> translateToStorageWarehouseSummaryData(List<Object[]> records){
        List<StorageWarehouseSummaryReportDto> lines = new ArrayList<>();
        int i = 0;
        Object object=null;
        StorageWarehouseSummaryReportDto line=null;
        for (Object[] obj : records) {
            i = 0;
            line = new StorageWarehouseSummaryReportDto();
            //
            object=obj[i++];
            line.setDivisionid(0L);
            if (object!=null){
                line.setDivisionid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            line.setTotal(0);
            if (object!=null){
                line.setTotal(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            line.setWorkalltotal(0);
            if (object!=null){
                line.setWorkalltotal(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            line.setWorkepaltotal(0);
            if (object!=null){
                line.setWorkepaltotal(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            line.setWorktasktotal(0);
            if (object!=null){
                line.setWorktasktotal(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            lines.add(line);
        }
        return lines;
    }

    public final static List<StorageAgeSummaryReportDto> translateToStorageAgeSummaryData(List<Object[]> records){
        List<StorageAgeSummaryReportDto> datas = new ArrayList<>();
        int i = 0;
        Object object=null;
        StorageAgeSummaryReportDto data=null;
        for (Object[] obj : records) {
            i = 0;
            data = new StorageAgeSummaryReportDto();
            //
            object=obj[i++];
            data.setDivisionid(0L);
            if (object!=null){
                data.setDivisionid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            data.setLessthanhalfyearcount(0);
            if (object!=null){
                data.setLessthanhalfyearcount(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            data.setLessthanoneyearcount(0);
            if (object!=null){
                data.setLessthanoneyearcount(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            data.setLessthantwoyearcount(0);
            if (object!=null){
                data.setLessthantwoyearcount(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            data.setOvertwoyearcount(0);
            if (object!=null){
                data.setOvertwoyearcount(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            datas.add(data);
        }
        return datas;
    }

    public final static List<StorageAgeContainerSummaryReportDto> translateToStorageAgeContainerSummaryData(List<Object[]> records){
        List<StorageAgeContainerSummaryReportDto> datas = new ArrayList<>();
        int i = 0;
        Object object=null;
        StorageAgeContainerSummaryReportDto data=null;
        for (Object[] obj : records) {
            i = 0;
            data = new StorageAgeContainerSummaryReportDto();
            //
            object=obj[i++];
            data.setDivisionid(0L);
            if (object!=null){
                data.setDivisionid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            data.setType("");
            if (object!=null){
                data.setType(object.toString());
            }
            //
            object=obj[i++];
            data.setTotal(0);
            if (object!=null){
                data.setTotal(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            datas.add(data);
        }
        return datas;
    }

    public final static List<StorageAgeListReportDto> translateToStorageAgeListData(List<Object[]> records){
        List<StorageAgeListReportDto> datas = new ArrayList<>();
        int i = 0;
        Object object=null;
        StorageAgeListReportDto data=null;
        for (Object[] obj : records) {
            i = 0;
            data = new StorageAgeListReportDto();
            //
            object=obj[i++];
            data.setId(0L);
            if (object!=null){
                data.setId(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            data.setDivisionid(0L);
            if (object!=null){
                data.setDivisionid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            data.setMaterialid(0L);
            if (object!=null){
                data.setMaterialid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            data.setMaterialcode("");
            if (object!=null){
                data.setMaterialcode(object.toString());
            }
            //
            object=obj[i++];
            data.setMaterialname("");
            if (object!=null){
                data.setMaterialname(object.toString());
            }
            //
            object=obj[i++];
            data.setLotattr06("");
            if (object!=null){
                data.setLotattr06(object.toString());
            }
            //
            object=obj[i++];
            data.setLotattr07("");
            if (object!=null){
                data.setLotattr07(object.toString());
            }
            //
            object=obj[i++];
            data.setQuantity(BigDecimal.ZERO);
            if (object!=null){
                data.setQuantity(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            data.setContainernumber("");
            if (object!=null){
                data.setContainernumber(object.toString());
            }
            //
            object=obj[i++];
            data.setTracenumber("");
            if (object!=null){
                data.setTracenumber(object.toString());
            }
            //
            object=obj[i++];
            data.setLocationcode("");
            if (object!=null){
                data.setLocationcode(object.toString());
            }
            //
            object=obj[i++];
            data.setReceivetime(null);
            if (object!=null){
                data.setReceivetime(object.toString());
            }
            //
            object=obj[i++];
            data.setAgerange("");
            if (object!=null){
                data.setAgerange(object.toString());
            }
            //
            object=obj[i++];
            data.setUdf01("");
            if (object!=null){
                data.setUdf01(object.toString());
            }
            //
            object=obj[i++];
            data.setUdf02("");
            if (object!=null){
                data.setUdf02(object.toString());
            }
            //
            object=obj[i++];
            data.setUdf03("");
            if (object!=null){
                data.setUdf03(object.toString());
            }
            //
            object=obj[i++];
            data.setUdf04("");
            if (object!=null){
                data.setUdf04(object.toString());
            }
            //
            object=obj[i++];
            data.setUdf05("");
            if (object!=null){
                data.setUdf05(object.toString());
            }
            //
            object=obj[i++];
            data.setStatus("");
            if (object!=null){
                data.setStatus(object.toString());
            }
            //
            datas.add(data);
        }
        return datas;
    }

    public final static List<TransDailySummaryReportDto> translateToTransDailySummaryData(List<Object[]> records){
        List<TransDailySummaryReportDto> lines = new ArrayList<>();
        int i = 0;
        Object object=null;
        TransDailySummaryReportDto line=null;
        for (Object[] obj : records) {
            i = 0;
            line = new TransDailySummaryReportDto();
            //
            object=obj[i++];
            line.setDivisionid(0L);
            if (object!=null){
                line.setDivisionid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            line.setReceivetotal(0);
            if (object!=null){
                line.setReceivetotal(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            line.setShiptotal(0);
            if (object!=null){
                line.setShiptotal(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            line.setTasktotal(0);
            if (object!=null){
                line.setTasktotal(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            lines.add(line);
        }
        return lines;
    }

    public final static List<TransMonthSummaryReportDto> translateToTransMonthData(List<Object[]> records){
        List<TransMonthSummaryReportDto> lines = new ArrayList<>();
        int i = 0;
        Long divid=null;
        Object object=null;
        TransMonthSummaryReportDto line=null;
        for (Object[] obj : records) {
            i = 0;
            line = new TransMonthSummaryReportDto();
            //
            object=obj[i++];
            line.setDivisionid(0L);
            if (object!=null){
                line.setDivisionid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            line.setMonthcode("");
            if (object!=null){
                line.setMonthcode((String)object);
            }
            //
            object=obj[i++];
            line.setReceivecount(0);
            if (object!=null){
                line.setReceivecount(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            line.setShipcount(0);
            if (object!=null){
                line.setShipcount(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            line.setWorkcount(0);
            if (object!=null){
                line.setWorkcount(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            lines.add(line);
        }
        return lines;
    }

    public final static List<TransConsDailySummaryReportDto> translateToTransConsDailySummaryData(List<Object[]> records){
        List<TransConsDailySummaryReportDto> lines = new ArrayList<>();
        int i = 0;
        Long divid=null;
        Object object=null;
        TransConsDailySummaryReportDto line=null;
        for (Object[] obj : records) {
            i = 0;
            line = new TransConsDailySummaryReportDto();
            //
            object=obj[i++];
            line.setDivisionid(0L);
            if (object!=null){
                line.setDivisionid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            line.setReportdate("");
            if (object!=null){
                line.setReportdate((String)object);
            }
            //
            object=obj[i++];
            line.setReceivepaltotal(0);
            if (object!=null){
                line.setReceivepaltotal(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            line.setShippaltotal(0);
            if (object!=null){
                line.setShippaltotal(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            line.setReceivematerialtotal(0);
            if (object!=null){
                line.setReceivematerialtotal(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            object=obj[i++];
            line.setShipmaterialtotal(0);
            if (object!=null){
                line.setShipmaterialtotal(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            lines.add(line);
        }
        return lines;
    }

    public final static List<StationSummaryItemDto> translateToStationWorkSummryhData(List<Object[]> records){
        List<StationSummaryItemDto> lines = new ArrayList<>();
        int i = 0;
        Long divid=null;
        Object object=null;
        StationSummaryItemDto line=null;
        for (Object[] obj : records) {
            i = 0;
            line = new StationSummaryItemDto();
            //
            object=obj[i++];
            line.setDivisionid(0L);
            if (object!=null){
                line.setDivisionid(WmsReportUtils.longValueData(object));
            }
            //
            object=obj[i++];
            line.setStationcode("");
            if (object!=null){
                line.setStationcode((String)object);
            }
            //
            object=obj[i++];
            line.setTotal(0);
            if (object!=null){
                line.setTotal(WmsReportUtils.bigdecimalValueOf(object).intValue());
            }
            //
            lines.add(line);
        }
        return lines;
    }


//------------------------------------------------------------------------------------------------------------------
//  TRANSLATE/列表
//------------------------------------------------------------------------------------------------------------------
    //当天入库单
    public final static List<CommonDocumentDetailsDto> translateToInboundTodayDocData(List<Object[]> records) {
        List<CommonDocumentDetailsDto> lines = new ArrayList<>();
        int i = 0;
        Object object = null;
        CommonDocumentDetailsDto line = null;

        /**
         //vwa_doc_asn_details_today
         ---------------------------------------------
         t1.gclient_id, t1.customer_id, t1.division_id,
         t1.asn_id, t1.doc_number, doc_type, t1.doc_prior, t1.ref_doc_number, t1.doc_status,
         t1.asn_details_id, t1.line_number, t1.material_id, t1.material_code,t1.material_name, t1.spec_model,
         t1.lotattr05, t1.qty_ordered, t1.qty_ordered_each, t1.qty_received, t1.qty_received_each, t1.line_status, t1.created_date
        **/
        for (Object[] obj : records) {
            i = 0;
            line = new CommonDocumentDetailsDto();
            //
            object = obj[i++];
            line.setGclientid(0L);
            if (object != null) {
                line.setGclientid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setCustomerid(0L);
            if (object != null) {
                line.setCustomerid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setDivisionid(0L);
            if (object != null) {
                line.setDivisionid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setDocumentid(0L);
            if (object != null) {
                line.setDocumentid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setDocumentnumber("");
            if (object != null) {
                line.setDocumentnumber((String) object);
            }
            //
            object = obj[i++];
            line.setDocumenttype("");
            if (object != null) {
                line.setDocumenttype((String) object);
            }
            //
            object = obj[i++];
            line.setDocumentprior("");
            if (object != null) {
                line.setDocumentprior((String) object);
            }
            //
            object = obj[i++];
            line.setRefnumber("");
            if (object != null) {
                line.setRefnumber((String) object);
            }
            //
            object = obj[i++];
            line.setDocumentstatus("");
            if (object != null) {
                line.setDocumentstatus((String) object);
            }
            //
            object = obj[i++];
            line.setDetailsid(0L);
            if (object != null) {
                line.setDetailsid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setLinenumber("");
            if (object != null) {
                line.setLinenumber((String) object);
            }
            //
            object = obj[i++];
            line.setMaerialid(0L);
            if (object != null) {
                line.setMaerialid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setMaerialcode("");
            if (object != null) {
                line.setMaerialcode((String) object);
            }
            //
            object = obj[i++];
            line.setMaerialname("");
            if (object != null) {
                line.setMaerialname((String) object);
            }
            //
            object = obj[i++];
            line.setMaerialspec("");
            if (object != null) {
                line.setMaerialspec((String) object);
            }
            //
            object = obj[i++];
            line.setLotnumber("");
            if (object != null) {
                line.setLotnumber((String) object);
            }
            //
            object=obj[i++];
            line.setQtyordered(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyordered(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyorderedeach(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyorderedeach(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyfinished(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyfinished(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyfinishedeach(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyfinishedeach(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object = obj[i++];
            line.setLinestatus("");
            if (object != null) {
                line.setLinestatus((String) object);
            }
            //
            object=obj[i++];
            line.setCreateddate(null);
            if (object!=null){
                line.setCreateddate(WmsReportUtils.dateValueOf(object));
            }
            //
            lines.add(line);
        }
        return lines;
    }


    public final static List<CommonTransDetailsDto> translateToInboundTodayReceiveTransSumData(List<Object[]> records) {
        List<CommonTransDetailsDto> lines = new ArrayList<>();
        int i = 0;
        Object object = null;
        CommonTransDetailsDto line = null;

        /**
         //vwt_act_recv_trans_today_sum
         ---------------------------------------------
         t1.gclient_id,t1.customer_id,t1.division_id,
         t1.trans_type,
         t2.material_id, t2.material_code, t2.material_name, t2.spec_model,
         t1.from_lotattr05,  qty_trans,  qty_trans_each
         **/
        for (Object[] obj : records) {
            i = 0;
            line = new CommonTransDetailsDto();
            //
            object = obj[i++];
            line.setGclientid(0L);
            if (object != null) {
                line.setGclientid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setCustomerid(0L);
            if (object != null) {
                line.setCustomerid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setDivisionid(0L);
            if (object != null) {
                line.setDivisionid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setTranstype("");
            if (object != null) {
                line.setTranstype((String) object);
            }
            //
            object = obj[i++];
            line.setMaerialid(0L);
            if (object != null) {
                line.setMaerialid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setMaerialcode("");
            if (object != null) {
                line.setMaerialcode((String) object);
            }
            //
            object = obj[i++];
            line.setMaerialname("");
            if (object != null) {
                line.setMaerialname((String) object);
            }
            //
            object = obj[i++];
            line.setMaerialspec("");
            if (object != null) {
                line.setMaerialspec((String) object);
            }
            //
            object = obj[i++];
            line.setFromlotnumber("");
            if (object != null) {
                line.setFromlotnumber((String) object);
            }
            //
            object=obj[i++];
            line.setQtytrans(BigDecimal.ZERO);
            if (object!=null){
                line.setQtytrans(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtytranseach(BigDecimal.ZERO);
            if (object!=null){
                line.setQtytranseach(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            lines.add(line);
        }
        return lines;
    }

    public final static List<CommonInventoryDetailsDto> translateToInboundTodayHoldStorageData(List<Object[]> records) {
        List<CommonInventoryDetailsDto> lines = new ArrayList<>();
        int i = 0;
        Object object = null;
        CommonInventoryDetailsDto line = null;

        /**
         //vwa_inv_hold_storage_today
         ---------------------------------------------
         t2.material_id, t2.material_code, t2.material_name, t2.spec_model,
         t1.lot_number, t1.qty, t1.qty_allocated,
         t3.location_code, t1.contain_number, t1.trace_number, t1.storage_status, t1.receive_time
         **/
        for (Object[] obj : records) {
            i = 0;
            line = new CommonInventoryDetailsDto();
            //
            object = obj[i++];
            line.setGclientid(0L);
            if (object != null) {
                line.setGclientid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setCustomerid(0L);
            if (object != null) {
                line.setCustomerid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setDivisionid(0L);
            if (object != null) {
                line.setDivisionid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setMaerialid(0L);
            if (object != null) {
                line.setMaerialid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setMaerialcode("");
            if (object != null) {
                line.setMaerialcode((String) object);
            }
            //
            object = obj[i++];
            line.setMaerialname("");
            if (object != null) {
                line.setMaerialname((String) object);
            }
            //
            object = obj[i++];
            line.setMaerialspec("");
            if (object != null) {
                line.setMaerialspec((String) object);
            }
            //
            object = obj[i++];
            line.setLotnumber("");
            if (object != null) {
                line.setLotnumber((String) object);
            }
            //
            object=obj[i++];
            line.setQuantity(BigDecimal.ZERO);
            if (object!=null){
                line.setQuantity(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyallocated(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyallocated(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object = obj[i++];
            line.setLocationcode("");
            if (object != null) {
                line.setLocationcode((String) object);
            }
            //
            object = obj[i++];
            line.setContainnumber("");
            if (object != null) {
                line.setContainnumber((String) object);
            }
            //
            object = obj[i++];
            line.setTracenumber("");
            if (object != null) {
                line.setTracenumber((String) object);
            }
            //
            object = obj[i++];
            line.setStoragestatus("");
            if (object != null) {
                line.setStoragestatus((String) object);
            }
            //
            object=obj[i++];
            line.setReceivedate(null);
            if (object!=null){
                line.setReceivedate(WmsReportUtils.dateValueOf(object));
            }
            //
            lines.add(line);
        }
        return lines;
    }

    //当天出库单
    public final static List<CommonDocumentDetailsDto> translateToOutboundTodayDocData(List<Object[]> records) {
        List<CommonDocumentDetailsDto> lines = new ArrayList<>();
        int i = 0;
        Object object = null;
        CommonDocumentDetailsDto line = null;

        /**
         //vwa_doc_so_details_today
         ---------------------------------------------
         t1.gclient_id, t1.customer_id, t1.division_id,
         t1.so_id, t1.doc_number, doc_type, t1.doc_prior, t1.ref_doc_number, t1.doc_status,
         t1.so_details_id, t1.line_number, t1.material_id, t1.material_code,t1.material_name, t1.spec_model,
         t1.lotattr05, t2.qty_ordered, t2.qty_ordered_each, t1.qty_allocated, t2.qty_allocated_each, t2.qty_shipped, t2.qty_shipped_each, t1.line_status, t1.created_date
         **/
        for (Object[] obj : records) {
            i = 0;
            line = new CommonDocumentDetailsDto();
            //
            object = obj[i++];
            line.setGclientid(0L);
            if (object != null) {
                line.setGclientid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setCustomerid(0L);
            if (object != null) {
                line.setCustomerid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setDivisionid(0L);
            if (object != null) {
                line.setDivisionid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setDocumentid(0L);
            if (object != null) {
                line.setDocumentid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setDocumentnumber("");
            if (object != null) {
                line.setDocumentnumber((String) object);
            }
            //
            object = obj[i++];
            line.setDocumenttype("");
            if (object != null) {
                line.setDocumenttype((String) object);
            }
            //
            object = obj[i++];
            line.setDocumentprior(WmsConstants.TASK_PRIOR_NORMAL);
            if (object != null) {
                line.setDocumentprior((String) object);
            }
            //
            object = obj[i++];
            line.setRefnumber("");
            if (object != null) {
                line.setRefnumber((String) object);
            }
            //
            object = obj[i++];
            line.setDocumentstatus("");
            if (object != null) {
                line.setDocumentstatus((String) object);
            }
            //
            object = obj[i++];
            line.setDetailsid(0L);
            if (object != null) {
                line.setDetailsid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setLinenumber("");
            if (object != null) {
                line.setLinenumber((String) object);
            }
            //
            object = obj[i++];
            line.setMaerialid(0L);
            if (object != null) {
                line.setMaerialid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setMaerialcode("");
            if (object != null) {
                line.setMaerialcode((String) object);
            }
            //
            object = obj[i++];
            line.setMaerialname("");
            if (object != null) {
                line.setMaerialname((String) object);
            }
            //
            object = obj[i++];
            line.setMaerialspec("");
            if (object != null) {
                line.setMaerialspec((String) object);
            }
            //
            object = obj[i++];
            line.setLotnumber("");
            if (object != null) {
                line.setLotnumber((String) object);
            }
            //
            object=obj[i++];
            line.setQtyordered(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyordered(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyorderedeach(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyorderedeach(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyallocated(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyallocated(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyallocatedeach(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyallocatedeach(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyfinished(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyfinished(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyfinishedeach(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyfinishedeach(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object = obj[i++];
            line.setLinestatus("");
            if (object != null) {
                line.setLinestatus((String) object);
            }
            //
            object=obj[i++];
            line.setCreateddate(null);
            if (object!=null){
                line.setCreateddate(WmsReportUtils.dateValueOf(object));
            }
            //
            lines.add(line);
        }
        return lines;
    }

    //当天出库单-物料+批次汇总
    public final static List<CommonDocumentDetailsDto> translateToOutboundTodayDocSumData(List<Object[]> records) {
        List<CommonDocumentDetailsDto> lines = new ArrayList<>();
        int i = 0;
        Object object = null;
        CommonDocumentDetailsDto line = null;

        /**
         //vwa_doc_so_details_today_sum
         ---------------------------------------------
         t1.gclient_id, t1.customer_id, t1.division_id,
         t1.material_id, t1.material_code,t1.material_name, t1.spec_model,
         t1.lotattr05, t2.qty_ordered, t2.qty_ordered_each, t1.qty_allocated, t2.qty_allocated_each, t2.qty_shipped, t2.qty_shipped_each
         **/
        for (Object[] obj : records) {
            i = 0;
            line = new CommonDocumentDetailsDto();
            //
            object = obj[i++];
            line.setGclientid(0L);
            if (object != null) {
                line.setGclientid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setCustomerid(0L);
            if (object != null) {
                line.setCustomerid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setDivisionid(0L);
            if (object != null) {
                line.setDivisionid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setMaerialid(0L);
            if (object != null) {
                line.setMaerialid(WmsReportUtils.longValueData(object));
            }
            //
            object = obj[i++];
            line.setMaerialcode("");
            if (object != null) {
                line.setMaerialcode((String) object);
            }
            //
            object = obj[i++];
            line.setMaerialname("");
            if (object != null) {
                line.setMaerialname((String) object);
            }
            //
            object = obj[i++];
            line.setMaerialspec("");
            if (object != null) {
                line.setMaerialspec((String) object);
            }
            //
            object = obj[i++];
            line.setLotnumber("");
            if (object != null) {
                line.setLotnumber((String) object);
            }
            //
            object=obj[i++];
            line.setQtyordered(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyordered(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyorderedeach(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyorderedeach(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyallocated(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyallocated(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyallocatedeach(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyallocatedeach(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyfinished(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyfinished(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            object=obj[i++];
            line.setQtyfinishedeach(BigDecimal.ZERO);
            if (object!=null){
                line.setQtyfinishedeach(WmsReportUtils.bigdecimalValueOf(object));
            }
            //
            lines.add(line);
        }
        return lines;
    }

//------------------------------------------------------------------------------------------------------------------
//  private
//------------------------------------------------------------------------------------------------------------------
    private final static void baseCheck(Map<String, Object> query, StringBuffer buf, String alias){
        if ((query==null) || (query.size()==0)){
            return;
        }
        if (buf==null){
            return;
        }
        try {
            if (query.get("gclient_id") != null) {
                if (!StringUtils.isNullOrBlank(alias)){
                    buf.append("and ").append(alias.trim()).append(".");
                }
                buf.append("gclient_id=").append(query.get("gclient_id")).append(" ");
            }
            if (query.get(XcmgAmConstants.DIVISION_ID_FIELD_CODE) != null) {
                if (!StringUtils.isNullOrBlank(alias)){
                    buf.append("and ").append(alias.trim()).append(".");
                }
                buf.append(XcmgAmConstants.DIVISION_ID_FIELD_CODE).append("=").append(query.get(XcmgAmConstants.DIVISION_ID_FIELD_CODE)).append(" ");
            }
            if (query.get("customer_id") != null) {
                if (!StringUtils.isNullOrBlank(alias)){
                    buf.append("and ").append(alias.trim()).append(".");
                }
                buf.append("customer_id=").append(query.get("customer_id")).append(" ");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


//------------------------------------------------------------------------------------------------------------------
//  sql-list/
//------------------------------------------------------------------------------------------------------------------

    private final static void baseTransSelectList(StringBuffer buf, String alias) {
        if (buf == null) {
            return;
        }
        if ((!StringUtils.isNullOrBlank(alias)) && (!alias.endsWith("."))){
            alias=alias.trim()+".";
        }
        buf.append(alias).append("trans_id,");
        buf.append(alias).append("division_id,");
        buf.append(alias).append("trans_type,");
        buf.append(alias).append("doc_id,");
        buf.append(alias).append("doc_number,");
        buf.append(alias).append("material_id,");
        buf.append(alias).append("material_code,");
        buf.append(alias).append("material_name,");
        buf.append(alias).append("from_lotno_id,");
        buf.append(alias).append("from_lotattr05,");
        buf.append(alias).append("qty_trans,");
        buf.append(alias).append("qty_trans_each,");
        buf.append(alias).append("from_trace_number,");
        buf.append(alias).append("from_contain_number,");
        buf.append(alias).append("created_date,");
        buf.append(alias).append("created_by ");
    }

    private final static String nativeReceiveTransDailySelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        baseTransSelectList(buf, "t1");
        buf.append("from vwt_act_recv_trans_daily    t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeReceiveTransDailyOrderby(Map<String, Object> query) {
       return "";
    }



    private final static String nativeStoragePutawayHoldSummaryDailySelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.division_id, t1.total ");
        buf.append("from vwa_inv_storage_pa_hold_summ    t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeStoragePutawayHoldSummaryDailyOrderby(Map<String, Object> query) {
        return "";
    }



    private final static String nativeSoDocumentDailySelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.so_id, t1.doc_number, t1.packing_consume, t1.sortation_location_code, t1.work_handle_code, t1.doc_status, t1.notes ");
        buf.append("from vwa_doc_so_header_daily  t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeSoDocumentDailyOrderby(Map<String, Object> query) {
        return "";
    }


    private final static String nativeSoDocumentLineDailySelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.division_id, t1.so_details_id, t1.so_id, t1.doc_number, t1.ref_number, t1.doc_prior, t1.doc_status, ");
        buf.append("  t1.sortation_location_code, t1.work_handle_code, t1.notes, ");
        buf.append("  t1.material_id, t1.material_code, t1.material_name, ");
        buf.append("  t1.qty_ordered, t1.qty_ordered_each, t1.qty_allocated, t1.qty_allocated_each, t1.qty_shipped, t1.qty_shipped_each,");
        buf.append("  t1.line_number, t1.line_status, t1.created_date ");
        buf.append("from vwa_doc_so_details_daily  t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeSoDocumentLineDailyOrderby(Map<String, Object> query) {
        return "";
    }



    private final static String nativeStorageLaneSummaryDailySelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.division_id, t1.lane_num, ");
        buf.append("  t1.total, t1.work_count, t1.work_full_count, t1.work_half_count, t1.epal_count ");
        buf.append("from vwa_inv_loc_usage_lane_summ  t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeStorageLaneSummaryDailyOrderby(Map<String, Object> query) {
        return "";
    }

    /**
    private final static String nativeStorageWarehouseSummarySelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select t1.division_id, ");
        buf.append("  count(t1.location_id) as total, ");
        buf.append("  isnull((select count(distinct t31.loc_id) from twa_inv_details t31 where t31.qty>0 and t31.division_id=t1.division_id),0) as work_all_toatal, ");
        buf.append("  isnull((select count(distinct t41.loc_id) from twa_inv_details t41 where t41.qty>0 and t41.division_id=t1.division_id ");
        buf.append("          and t41.material_id=1000100100010 ),0) as work_epal_toal, ");
        buf.append("  isnull((select count(distinct t51.from_contain_number) from twt_act_task_list t51 where t51.task_status not in ('0880','0850','0910') ");
        buf.append("          and t51.division_id=t1.division_id ),0) as work_task_toal ");
        buf.append("from twm_bas_location t1 ");
        buf.append("where 1=1 ");
        buf.append("  and t1.division_id in (1000100010010) ");
        buf.append("  and t1.location_type='BIN' ");
        baseCheck(query, buf, "t1");
        buf.append("group by t1.division_id ");

        //buf.append("group by ");
        return buf.toString();
    }
    **/

    private final static String nativeStorageWarehouseSummarySelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select t1.division_id, ");
        buf.append("  count(t1.location_id) as total, ");
        buf.append("  isnull((select count(distinct t31.loc_id) from twa_inv_details t31 left join twm_bas_location t32 on t31.loc_id=t32.location_id ");
        buf.append("          where t31.qty>0 and t31.division_id=t1.division_id and t32.location_type='BIN'),0) as work_all_toatal, ");
        buf.append("  isnull((select count(distinct t41.loc_id) from twa_inv_details t41 left join twm_bas_location t42 on t41.loc_id=t42.location_id");
        buf.append("          where t41.qty>0 and t41.division_id=t1.division_id and t42.location_type='BIN' ");
        buf.append("            and t41.material_id=1000100100010 ),0) as work_epal_toal, ");
        buf.append("  isnull((select count(distinct t51.from_contain_number) from twt_act_task_list t51 where t51.task_status not in ('0880','0850','0910') ");
        buf.append("          and t51.division_id=t1.division_id ),0) as work_task_toal ");
        buf.append("from twm_bas_location t1 ");
        buf.append("where 1=1 ");
        buf.append("  and t1.division_id in (1000100010010) ");
        buf.append("  and t1.location_type='BIN' ");
        baseCheck(query, buf, "t1");
        buf.append("group by t1.division_id ");

        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeStorageWarehouseSummaryOrderby(Map<String, Object> query) {
        return "";
    }


    private final static String nativeStorageAgeSummarySelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.division_id, ");
        buf.append("  t1.total_6_month, t1.total_12_month, t1.total_24_month, t1.total_24_plus_month ");
        buf.append("from vwa_inv_storage_age  t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeStorageAgeSummaryOrderby(Map<String, Object> query) {
        return "";
    }

    //

    private final static String nativeStorageAgeContainerSummarySelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.division_id, ");
        buf.append("  t1.month_age_range, t1.total  ");
        buf.append("from vwa_storage_age_container_summ  t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeStorageAgeContainerSummaryOrderby(Map<String, Object> query) {
        return "";
    }


    public final static String nativeStorageAgeListSelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.storage_id, t1.division_id, ");
        buf.append("  t1.material_id,  t1.material_code,  t1.material_name, ");
        buf.append("  t1.lotattr06, t1.lotattr07, t1.qty, ");
        buf.append("  t1.contain_number, t1.trace_number, t1.location_code, t1.receive_time, ");
        buf.append("  t1.age_range, ");
        buf.append("  t1.udf01, t1.udf02, t1.udf03, t1.udf04, t1.udf05,  ");
        buf.append("  t1.storage_status  ");
        buf.append("from vwa_storage_age_list  t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeStorageAgeListOrderby(Map<String, Object> query) {
        return "order by t1.storage_id ";
    }


    private final static String nativeTransTaskDailySummarySelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select t1.division_id, ");
        // RECV
        buf.append("  (select count(distinct t31.from_contain_number) ");
        buf.append("   from twt_act_trans_list t31 ");
        buf.append("   where t31.trans_type='RECV' and t31.trans_status='0880' ");
        buf.append("     and convert(date,t31.created_date)=convert(date,getdate()) ");
        buf.append("     and t31.division_id=t1.division_id) as recv_total, ");

        // SHIP
        buf.append("  (select count(distinct convert(varchar,t41.wave_details_id) + '/' + t41.from_contain_number) ");
        buf.append("   from twt_act_trans_list t41 ");
        buf.append("   where t41.trans_type='SHIP' and t41.trans_status='0880' ");
        buf.append("     and convert(date,t41.created_date)=convert(date,getdate()) ");
        buf.append("     and t41.division_id=t1.division_id) as ship_total, ");

        // TASK
        buf.append("  (select count(distinct t51.from_contain_number) ");
        buf.append("   from twt_act_task_list t51 ");
        buf.append("   where t51.task_type in ('PUTA','PICK') and t51.task_status not in ('0880','0850','0910') ");
        buf.append("     and convert(date,t51.created_date)=convert(date,getdate())  ");
        buf.append("     and t51.division_id=t1.division_id) as work_task_total  ");
        buf.append("from twm_bas_division t1  ");
        buf.append("where 1=1  ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeTransTaskDailySummaryOrderby(Map<String, Object> query) {
        return "";
    }




    private final static String nativeTransMonthSummarySelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.division_id, t1.report_month, ");
        buf.append("  t1.qty_recv, t1.qty_ship, t1.qty_trans_all ");
        buf.append("from vwt_act_trans_month_summ  t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeTransMonthSummaryOrderby(Map<String, Object> query) {
        return "";
    }


    private final static String nativeTransConsDailySummarySelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select top 5 t1.division_id, ");
        buf.append("  t1.report_date,  ");
        buf.append("  t1.recv_container_count, t1.ship_container_count, ");
        buf.append("  t1.recv_document_count, t1.ship_document_count  ");
        buf.append("from twt_act_daily_work_summary t1  ");
        buf.append("where 1=1  ");
        baseCheck(query, buf, "t1");
        buf.append(" and t1.work_status = 'Y' ");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeTransConsDailySummaryOrderby(Map<String, Object> query) {
        return "order by t1.report_date desc ";
    }


    private final static String nativeStationWorkSummaryDailySelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.division_id, t1.location_code, ");
        buf.append("  t1.qty_trans_all, t1.qty_recv, t1.qty_ship ");
        buf.append("from vwt_act_trans_station_summ  t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeStationWorkSummaryDailyOrderby(Map<String, Object> query) {
        return "";
    }


    private final static String nativeStationHoldPutawaySummaryDailySelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.division_id, t1.location_code, t1.total ");
        buf.append("from vwt_act_task_station_hold_recv_summ  t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeStationHoldPutawaySummaryDailyOrderby(Map<String, Object> query) {
        return "";
    }


    private final static String nativeStationHoldPickSummaryDailySelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.division_id, t1.location_code, t1.total ");
        buf.append("from vwt_act_task_station_hold_pick_summ  t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeStationHoldPickSummaryDailyOrderby(Map<String, Object> query) {
        return "";
    }

    private final static String nativeInboundTodayDocumentSelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.gclient_id, t1.customer_id, t1.division_id, ");
        buf.append("  t1.asn_id, t1.doc_number, doc_type, t1.doc_prior, t1.ref_doc_number, t1.doc_status, ");
        buf.append("  t1.asn_details_id, t1.line_number, t1.material_id, t1.material_code,t1.material_name, t1.spec_model, ");
        buf.append("  t1.lotattr05, t1.qty_ordered, t1.qty_ordered_each, t1.qty_received, t1.qty_received_each, t1.line_status, t1.created_date ");
        buf.append("from vwa_doc_asn_details_today  t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeInboundTodayDocumentOrderby(Map<String, Object> query) {
        return "order by t1.asn_id, t1.line_number  ";
    }


    private final static String nativeInboundTodayReceiveTransSumSelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.gclient_id, t1.customer_id, t1.division_id, ");
        buf.append("  t1.trans_type, ");
        buf.append("  t1.material_id, t1.material_code, t1.material_name, t1.spec_model, ");
        buf.append("  t1.from_lotattr05, t1.qty_trans, t1.qty_trans_each ");
        buf.append("from vwt_act_recv_trans_today_sum  t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeInboundTodayReceiveTransSumOrderby(Map<String, Object> query) {
        return "order by t1.material_code, t1.from_lotattr05  ";
    }


    private final static String nativeInboundTodayHoldStorageSelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.gclient_id, t1.customer_id, t1.division_id, ");
        buf.append("  t1.material_id, t1.material_code, t1.material_name, t1.spec_model, ");
        buf.append("  t1.lot_number, t1.qty, t1.qty_allocated, ");
        buf.append("  t1.location_code, t1.contain_number, t1.trace_number, t1.storage_status, t1.receive_time ");
        buf.append("from vwa_inv_hold_storage_today  t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeInboundTodayHoldStorageOrderby(Map<String, Object> query) {
        return "order by t1.location_code, t1.trace_number, t1.material_code, t1.lot_number  ";
    }


    private final static String nativeOutboundTodayDocumentSelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.gclient_id, t1.customer_id, t1.division_id, ");
        buf.append("  t1.so_id, t1.doc_number, doc_type, t1.doc_prior, t1.ref_doc_number, t1.doc_status, ");
        buf.append("  t1.so_details_id, t1.line_number, t1.material_id, t1.material_code,t1.material_name, t1.spec_model, ");
        buf.append("  t1.lotattr05, t1.qty_ordered, t1.qty_ordered_each, t1.qty_allocated, t1.qty_allocated_each, t1.qty_shipped, t1.qty_shipped_each, t1.line_status, t1.created_date ");
        buf.append("from vwa_doc_so_details_today  t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeOutboundTodayDocumentOrderby(Map<String, Object> query) {
        return "order by t1.so_id, t1.line_number  ";
    }

    private final static String nativeOutboundTodayDocumentSumSelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.gclient_id, t1.customer_id, t1.division_id, ");
        buf.append("  t1.material_id, t1.material_code,t1.material_name, t1.spec_model, ");
        buf.append("  t1.lotattr05, t1.qty_ordered, t1.qty_ordered_each, t1.qty_allocated, t1.qty_allocated_each, t1.qty_shipped, t1.qty_shipped_each  ");
        buf.append("from vwa_doc_so_details_today_sum  t1 ");
        buf.append("where 1=1 ");
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeOutboundTodayDocumentSumOrderby(Map<String, Object> query) {
        return "order by t1.material_code, t1.lotattr05  ";
    }



    private final static String nativeOutboundDocumentDetailsSelect(Map<String, Object> query) {
        //
        StringBuffer buf = new StringBuffer();
        buf.append("select ");
        buf.append("  t1.gclient_id, t1.customer_id, t1.division_id, ");
        buf.append("  t1.so_id, t1.doc_number, doc_type, t1.doc_prior, t1.ref_doc_number, t1.doc_status, ");
        buf.append("  t1.so_details_id, t1.line_number, t1.material_id, t1.material_code,t1.material_name, t1.spec_model, ");
        buf.append("  t1.lotattr05, t1.qty_ordered, t1.qty_ordered_each, t1.qty_allocated, t1.qty_allocated_each, t1.qty_shipped, t1.qty_shipped_each, t1.line_status, t1.created_date ");
        buf.append("from vwa_doc_so_details_list  t1 ");
        buf.append("where 1=1 ");
        Object obj=query.get("documentnumber");
        String docnum=null;
        if (obj!=null){
            docnum=obj.toString();
        }
        if (!StringUtils.isNullOrBlank(docnum)){
            buf.append("and  t1.doc_number='").append(docnum.trim()).append("'  ");
        }
        baseCheck(query, buf, "t1");
        //buf.append("group by ");
        return buf.toString();
    }

    private final static String nativeOutboundDocumentDetailsOrderby(Map<String, Object> query) {
        return "order by t1.so_id, t1.line_number  ";
    }





//------------------------------------------------------------------------------------------------------------------
//  DEMO
//------------------------------------------------------------------------------------------------------------------



    //入库汇总
    public final static InboundSummaryDailyReportDto mockInboundSummaryDailyReport(){
        InboundSummaryDailyReportDto data = new InboundSummaryDailyReportDto();
        data.setDocuemttotal(21);
        data.setWorkfincount(136);
        data.setWorkholdcount(1);
        return data;
    }


    //出库汇总
    public final static OutboundSummaryDailyReportDto mockOutboundSummaryDailyReport(){
        OutboundSummaryDailyReportDto data = new OutboundSummaryDailyReportDto();
        data.setDocuemttotal(49);
        data.setDocuemtfincount(41);
        data.setDocuemtlostcount(2);
        data.setWorkfincount(215);
        return data;
    }


    //出库-作业中明细
    public final static List<OutboundWorklistDailyReportDto> mockOutboundWorklistDailyReport(){
        List<OutboundWorklistDailyReportDto> datas = new ArrayList<>();
        OutboundWorklistDailyReportDto doc=new OutboundWorklistDailyReportDto();

        doc.setDocumentnumber("LL-202411150041");
        doc.setProductionnumber("CA0090101");
        doc.setWorkstatus("INFO");
        doc.setWorkstatus("IMMD");

        datas.add(doc);
        return datas;
    }

    //出库-异常订单
    public final static List<OutboundAbnormallistDailyReportDto> mockOutboundAbnormallistDailyReport(){
        List<OutboundAbnormallistDailyReportDto> datas = new ArrayList<>();
        OutboundAbnormallistDailyReportDto doc=new OutboundAbnormallistDailyReportDto();

        doc.setDocumentnumber("LL-202411150071");
        doc.setProductionnumber("CA0090104");
        doc.setWorkstatus("INFO");

        OutboundDocumentLineReportDto line =new OutboundDocumentLineReportDto();
        line.setLinenumber("0010");
        line.setMaterialcode("5043007914");
        line.setMaterialname("换能器(F)");
        line.setSpelmodel("GJB2-10-01(F)");
        line.setQtyordered(new BigDecimal("120"));
        line.setQtyallocated(new BigDecimal("100"));
        line.setQtyshipped(new BigDecimal("0"));

        doc.setLines(Arrays.asList(line));

        datas.add(doc);
        return datas;
    }

    //库存汇总
    public final static StorageSummaryReportDto mockStorageSummaryReport(){
        StorageSummaryReportDto data = new StorageSummaryReportDto();
        data.setFullcontainercount(1000);
        data.setHalfcontainercount(41);
        data.setEmptycontainercount(1800);
        data.setReservecount(215);
        return data;
    }

    //库存汇总-按巷道
    public final static List<StorageLaneSummaryReportDto> mockStorageLaneSummaryReport(){
        List<StorageLaneSummaryReportDto> datas = new ArrayList<>();

        StorageLaneSummaryReportDto lane01=new StorageLaneSummaryReportDto();
        lane01.setLanenumber(1);
        lane01.setFullcontainerpercent(new BigDecimal(103/932f).setScale(4, RoundingMode.HALF_UP));
        lane01.setFullcontainerpercent(new BigDecimal(103/932f).setScale(4, RoundingMode.HALF_UP));
        lane01.setHalfcontainerpercent(new BigDecimal(6/932f).setScale(4, RoundingMode.HALF_UP));
        lane01.setEmptycontainerpercent(new BigDecimal(771/932f).setScale(4, RoundingMode.HALF_UP));
        lane01.setReservepercent(new BigDecimal(52/932f).setScale(4, RoundingMode.HALF_UP));
        lane01.setReservepercent(BigDecimal.ONE.subtract(lane01.getFullcontainerpercent()).subtract(lane01.getHalfcontainerpercent()).subtract(lane01.getEmptycontainerpercent()));

        StorageLaneSummaryReportDto lane02=new StorageLaneSummaryReportDto();
        lane02.setLanenumber(2);
        lane02.setFullcontainerpercent(new BigDecimal(183/1320f).setScale(4, RoundingMode.HALF_UP));
        lane02.setHalfcontainerpercent(new BigDecimal(15/1320f).setScale(4, RoundingMode.HALF_UP));
        lane02.setEmptycontainerpercent(new BigDecimal(945/1320f).setScale(4, RoundingMode.HALF_UP));
        lane02.setReservepercent(new BigDecimal(177/1320f).setScale(4, RoundingMode.HALF_UP));
        lane02.setReservepercent(BigDecimal.ONE.subtract(lane02.getFullcontainerpercent()).subtract(lane02.getHalfcontainerpercent()).subtract(lane02.getEmptycontainerpercent()));

        StorageLaneSummaryReportDto lane03=new StorageLaneSummaryReportDto();
        lane03.setLanenumber(3);
        lane03.setFullcontainerpercent(new BigDecimal(684/1320f).setScale(4, RoundingMode.HALF_UP));
        lane03.setHalfcontainerpercent(new BigDecimal(41/1320f).setScale(4, RoundingMode.HALF_UP));
        lane03.setEmptycontainerpercent(new BigDecimal(503/1320f).setScale(4, RoundingMode.HALF_UP));
        lane03.setReservepercent(new BigDecimal(92/1320f).setScale(4, RoundingMode.HALF_UP));
        lane03.setReservepercent(BigDecimal.ONE.subtract(lane03.getFullcontainerpercent()).subtract(lane03.getHalfcontainerpercent()).subtract(lane03.getEmptycontainerpercent()));

        datas.add(lane01);
        datas.add(lane02);
        datas.add(lane03);
        return datas;
    }


    //库龄
    public final static StorageAgeSummaryReportDto mockStorageAgeSummaryReport(){
        StorageAgeSummaryReportDto data = new StorageAgeSummaryReportDto();
        data.setLessthanhalfyearcount(6043);
        data.setLessthanoneyearcount(0);
        data.setLessthantwoyearcount(0);
        data.setOvertwoyearcount(0);
        return data;
    }


    //月度作业
    public final static List<TransMonthSummaryReportDto> mockTransMonthSummaryReport(){
        List<TransMonthSummaryReportDto> datas = new ArrayList<>();

        TransMonthSummaryReportDto m09=new TransMonthSummaryReportDto();
        m09.setMonthcode("09月");
        m09.setReceivecount(1031);
        m09.setShipcount(303);
        m09.setWorkcount(m09.getReceivecount()+m09.getShipcount());

        TransMonthSummaryReportDto m10=new TransMonthSummaryReportDto();
        m10.setMonthcode("10月");
        m10.setReceivecount(3091);
        m10.setShipcount(2093);
        m10.setWorkcount(m10.getReceivecount()+m10.getShipcount());

        TransMonthSummaryReportDto m11=new TransMonthSummaryReportDto();
        m11.setMonthcode("11月");
        m11.setReceivecount(1737);
        m11.setShipcount(1183);
        m11.setWorkcount(m11.getReceivecount()+m11.getShipcount());

        TransMonthSummaryReportDto m12=new TransMonthSummaryReportDto();
        m12.setMonthcode("");
        m12.setReceivecount(null);
        m12.setShipcount(null);
        m12.setWorkcount(null);
        //m12.setWorkcount(m12.getReceivecount()+m12.getShipcount());


        TransMonthSummaryReportDto m01=new TransMonthSummaryReportDto();
        m01.setMonthcode("");
        m01.setReceivecount(null);
        m01.setShipcount(null);
        //m01.setWorkcount(m01.getReceivecount()+m01.getShipcount());
        m01.setWorkcount(null);


        TransMonthSummaryReportDto m02=new TransMonthSummaryReportDto();
        m02.setMonthcode("");
        m02.setReceivecount(null);
        m02.setShipcount(null);
        //m02.setWorkcount(m02.getReceivecount()+m02.getShipcount());
        m02.setWorkcount(null);


        TransMonthSummaryReportDto m03=new TransMonthSummaryReportDto();
        m03.setMonthcode("");
        m03.setReceivecount(null);
        m03.setShipcount(null);
        //m03.setWorkcount(m03.getReceivecount()+m03.getShipcount());
        m03.setWorkcount(null);


        TransMonthSummaryReportDto m04=new TransMonthSummaryReportDto();
        m04.setMonthcode("");
        m04.setReceivecount(null);
        m04.setShipcount(null);
        //m04.setWorkcount(m04.getReceivecount()+m04.getShipcount());
        m04.setWorkcount(null);

        TransMonthSummaryReportDto m05=new TransMonthSummaryReportDto();
        m05.setMonthcode("");
        m05.setReceivecount(null);
        m05.setShipcount(null);
        //m05.setWorkcount(m05.getReceivecount()+m05.getShipcount());
        m05.setWorkcount(null);

        TransMonthSummaryReportDto m06=new TransMonthSummaryReportDto();
        m06.setMonthcode("");
        m06.setReceivecount(null);
        m06.setShipcount(null);
        //m06.setWorkcount(m06.getReceivecount()+m06.getShipcount());
        m06.setWorkcount(null);

        TransMonthSummaryReportDto m07=new TransMonthSummaryReportDto();
        m07.setMonthcode("");
        m07.setReceivecount(null);
        m07.setShipcount(null);
        //m07.setWorkcount(m07.getReceivecount()+m07.getShipcount());
        m07.setWorkcount(null);

        TransMonthSummaryReportDto m08=new TransMonthSummaryReportDto();
        m08.setMonthcode("");
        m08.setReceivecount(null);
        m08.setShipcount(null);
        //m08.setWorkcount(m08.getReceivecount()+m08.getShipcount());
        m08.setWorkcount(null);

        datas.add(m09);
        datas.add(m10);
        datas.add(m11);
        datas.add(m12);
        datas.add(m01);
        datas.add(m02);
        datas.add(m03);
        datas.add(m04);
        datas.add(m05);
        datas.add(m06);
        datas.add(m07);
        datas.add(m08);
        return datas;
    }

    //月度作业
    public final static List<StationSummaryDailyReportDto> mockStationSummaryDailyReport() {
        List<StationSummaryDailyReportDto> datas = new ArrayList<>();

        StationSummaryDailyReportDto sb0101 = new StationSummaryDailyReportDto("SB0101");
        sb0101.setFincount(93);
        sb0101.setWorkingcount(13);

        StationSummaryDailyReportDto sb0102 = new StationSummaryDailyReportDto("SB0102");
        sb0102.setFincount(193);
        sb0102.setWorkingcount(11);

        StationSummaryDailyReportDto sb0103 = new StationSummaryDailyReportDto("SB0103");
        sb0103.setFincount(98);
        sb0103.setWorkingcount(4);

        datas.add(sb0101);
        datas.add(sb0102);
        datas.add(sb0103);
        return datas;
    }

}
